#include "fxcc/core/graph/common/LightData.h"

using namespace fxcc::graph::common;


LightData::LightData(aiLight *light)
{
    Load(light->mName, m_Name);
    Load(light->mPosition, m_Position);
    Load(light->mDirection, m_Direction);
    Load(light->mUp, m_Up);

    m_EffectData.m_AttenuationConstant = light->mAttenuationConstant;
    m_EffectData.m_AttenuationLinear = light->mAttenuationLinear;
    m_EffectData.m_AttenuationQuadratic = light->mAttenuationQuadratic;

    memcpy(&m_EffectData.m_Type, &light->mType, sizeof(light->mType));

    Load(light->mColorAmbient, m_EffectData.m_ColorAmbient);
    Load(light->mColorDiffuse, m_EffectData.m_ColorDiffuse);
    Load(light->mColorSpecular,m_EffectData.m_ColorSpecular);
    m_EffectData.m_ColorAmbient /= 1000.0f;
    m_EffectData.m_ColorDiffuse/= 1000.0f;
    m_EffectData.m_ColorSpecular /= 1000.0f;

    m_EffectData.m_AngleInnerCone = light->mAngleInnerCone;
    m_EffectData.m_AngleOuterCone = light->mAngleOuterCone;

    Load(light->mSize, m_EffectData.m_Size);
}